package com.example.mall.user.svc.domain.model.vo;

import com.example.mall.user.svc.infr.constants.LoginModeType;
import com.example.mall.common.handler.ArrayTypeHandler;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.List;

/**
 * @author Mickey
 * @since 2022/4/13
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoginMode implements Serializable {

    private String uniqueId;
    private LoginModeType type;

    @Component
    public static class LoginModeArrayType extends ArrayTypeHandler<LoginMode> {
        public LoginModeArrayType(ObjectMapper objectMapper) {
            super(objectMapper);
        }

        @Override
        public TypeReference<List<LoginMode>> getType() {
            return new TypeReference<List<LoginMode>>() {
            };
        }
    }

}
